<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all"/>
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <!--/*@thymesVar id="id" type="aj"*/-->
<!--    <input type="hidden" th:value="${user.id}" name="id"/>-->
    <div>
        <table id="test1" lay-filter="userTable"  class="layui-table"  border="1">
            <tr>
                <th>姓名</th>
                <th>认证状态</th>
                <th>状态</th>
                <th>创建时间</th>
                <th>证件类型</th>
                <th>证件号</th>
                <th>证件图片</th>
            </tr>
            <tr>
                <td th:text="${userInfo.name}"></td>
                <td th:text="${userInfo.authStatus}"></td>
                <td th:text="${userInfo.status}"></td>
                <td th:text="${userInfo.certificatesType}"></td>
                <td th:text="${userInfo.certificatesNo}"></td>
                <td th:text="${userInfo.certificatesUrl}"></td>
            </tr>
        </table>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="shBtn">确认审核</button>
        </div>
    </div>
</div>
<script th:src="@{/layui/layui.js}" charset="utf-8"></script>
<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>
<script th:src="@{/js/jquery-3.3.1.min.js}"></script>

<script th:inline="javascript">


            table.use(['table','form'], function(obj) { //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
                var table=layui.table;

                form.on('submit(shBtn)', function (obj) {
                    var vdata = data.field;
                    var data = obj.data; //获得当前行数据
                    layer.confirm('确定要更改吗？', function () {
                        $.ajax({
                            url: "api/user/update/" + data.id,
                            method: "put",
                            dataType: 'json',
                            success: function (data) {
                                if (data.code == 0) {
                                    layer.alert(data.msg);
                                    table.reload('test'); //table的id
                                } else {
                                    layer.alert("操作失败");
                                }
                            }
                        })
                    });
                })
            })

</script>
</body>
</html>